package com.amigo.online.provider.video.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class OrderUtils {
    /**
     * 创建通用订单号
     *
     * @return
     */
//	private static final String PROMOTE_ORDER_NUMBER_PREFIX = "10";
    public static String createOrderNumber() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
                + (int) ((Math.random() * 9 + 1) * 1000);
    }

    /**
     * 创建速推业务订单号(订单号加了10，代表速推业务)
     *
     * @return
     */
    public static String createPromoteOrderNumber() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
                //*10是因为userede限制订单号长度小于18位，*1000超长报错
                + (int) ((Math.random() * 9 + 1) * 10);

    }
}

